<?php

class Image{

	var $db;

	public function __construct(){
		$this->db = new DBClass();
	}
	
	public function get_all_image(){
		
		$query = "Select * from images";

		$rows = $this->db->getRows($query);

		return $rows;	

	}
	public function deleteHal($data){
		
		$query ="DELETE FROM images WHERE id_gambar='".@$data."'";

		$rows = $this->db->getRows($query);

		header('Location: image.php');
	}

	public function addImage($data){
		
		$query ="INSERT INTO images SET jdl_gambar='".@$data['jdl_gambar']."',
		deskripsi='".@$data['deskripsi']."',alt='".@$data['alt']."',tgl_upload='".date('Y-m-d')."',
		url='".@$data['url']."'";

		$rows = $this->db->putRows($query);
		$insertID = $this->db->insertId();

		return $insertID;
	}


}